Strict

Import agfx

Global myTmpScreen:TTmpScreen

Class TAgfx_test_app Extends TFramework

	Method OnCreate:Int()
		
		Super.OnCreate()
				
		DISPLAY.SetVirtualSize(480,320)
		myTmpScreen = New TTmpScreen		
		myTmpScreen.Prepare()
		
		
		Return 0
	End
	
End

Class TTmpScreen Extends TScreen
	

	Field level_data:		TTiled_Map
	Field level_renderer:	TTiled_Renderer
	Field level_physics:	TTiled_Physics
	
	Field player_sprite:	TSprite
	Field player_control:	TmyPlayerControl
	Field player_body:		TBox2DBody
	
	Field off_x:Int=0
	Field off_y:Int=0
	
	Field slider:TGUISlider
	
	' START when app is created
	Method Start:Void()
	
		DEBUG = True
		
		' [0] load resources FIRST !!!!
		
		'RESOURCE.Load("resource_320x480.xml")
		
		' [1] create level data
		Self.level_data 		= New TTiled_Map()
		Self.level_data.Load("agfx_platform_test_import.xml")

		' [2] define layers order to render
		Self.level_renderer 	= New TTiled_Renderer(self.level_data)

		
		Self.level_renderer.AddRenderLayersOrder("Tile Layer 1")
		

		
	End
	
	' main app logic loop update
	Method Update:Void()
	
		
	
		Self.level_renderer.Update()
		
	End
	
	' main app render loop
	Method Render:Void()
	
		Cls
		Self.level_renderer.Render()
		
	End
End
